#!/usr/bin/perl 
# callsub.pl
use warnings;
use strict;

sub do_list {
   my ($subref, @in) = @_;
   my @out;
   map {push @out, &$subref ($_)} @in;
   return @out;
}

sub add_one {
   return $_[0] + 1;
}

$, = ",";
print do_list (\&add_one, 1, 2, 3);   # prints 2, 3, 4
